package com.yootk.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.stereotype.Component;

@Component
public class Emp implements SmartInitializingSingleton {
    private static final Logger LOGGER = LoggerFactory.getLogger(Emp.class) ;
    private String ename ;
    private double salary ;

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    @Override
    public void afterSingletonsInstantiated() {
        LOGGER.info("修改之前：{}",this.salary);
        if (this.salary < 0){
            this.salary = 800.0 ;
        }
        LOGGER.info("修改之后：{}",this.salary);
    }
}
